import { isWeChatBrowser } from '@/config/h5/index'
import TabsView from '@/layouts/TabsView'
// 路由配置
const options = {
  routes: [
    {
      path: '/login',
      name: '登录页',
      component: () => import('@/pages/h5/login')
    },
    {
      path: '*',
      name: '404',
      component: () => import('@/pages/h5/exception/404')
    },
    {
      path: '/403',
      name: '403',
      component: () => import('@/pages/h5/exception/403')
    },
    {
      path: '/500',
      name: '500',
      component: () => import('@/pages/h5/exception/500')
    },
    {
      path: '/',
      name: '登录页',
      component: TabsView,
      redirect: isWeChatBrowser ? '/loginToHome' : '/home'
    },
    {
      path: '/main',
      name: '首页',
      component: () => import('@/pages/h5/main'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: '首页',
          component: () => import('@/pages/h5/home'),
          meta: {
            keepAlive: false,
            appAgentToken: false
          }
        },
        {
          path: '/product',
          name: '产品',
          component: () => import('@/pages/h5/product'),
          meta: {
            keepAlive: false,
            appAgentToken: false
          }
        },
        {
          path: '/my',
          name: '我的',
          component: () => import('@/pages/h5/my'),
          meta: {
            keepAlive: false,
            appAgentToken: true
          }
        },
        {
          path: '/review',
          name: '万利大学直播回放',
          component: () => import('@/pages/h5/review'),
          meta: {
            keepAlive: false,
            appAgentToken: false
          }
        }
      ]
    },
    {
      path: '/scan',
      name: '扫描页面',
      component: () => import('@/pages/h5/common/scan')
    },
    {
      path: '/record',
      name: '榜单页面',
      component: () => import('@/pages/h5/record'),
      meta: {
        appAgentToken: true
      }
    },
    {
      path: '/recordDetail/:id?',
      name: '喜报',
      component: () => import('@/pages/h5/record/detail'),
      meta: {
        appAgentToken: false,
        back: '-1'
      }
    },
    {
      path: '/productOnline/:productId?',
      name: '产品详情',
      component: () => import('@/pages/h5/product/online'),
      meta: {
        appAgentToken: false,
        back: -1
      }
    },
    {
      path: '/car/:productId?',
      name: '车险投保页面',
      component: () => import('@/pages/h5/product/car'),
      meta: {
        appAgentToken: true,
        back: '-1'
      }
    },
    {
      path: '/carSecond',
      name: '车险投保页面',
      component: () => import('@/pages/h5/product/car/second')
    },
    {
      path: '/carThree',
      name: '车险投保页面',
      component: () => import('@/pages/h5/product/car/three')
    },
    {
      path: '/productOffline',
      name: '线下投保页面',
      component: () => import('@/pages/h5/product/offline'),
      meta: {
        appAgentToken: true,
        back: '-1'
      }
    },
    {
      path: '/productOffline/:productId?/insuranceOption',
      name: '投保选择页面',
      component: () => import('@/pages/h5/product/offline/insuranceOption')
    },
    {
      path: '/productOffline/:productId?/policyDistribution',
      name: '保单配送页面',
      component: () => import('@/pages/h5/product/offline/policyDistribution')
    },
    {
      path: '/reviewDetail/:id?',
      name: '回放详情',
      component: () => import('@/pages/h5/review/detail'),
      meta: {
        appAgentToken: false
        // back: '-1'
      }
    },
    {
      path: '/reviewList/:id?',
      name: '回放列表',
      component: () => import('@/pages/h5/review/list'),
      meta: {
        appAgentToken: false
        // back: '-1'
      }
    },
    {
      path: '/income',
      name: '预估收入',
      component: () => import('@/pages/h5/my/income'),
      meta: {
        appAgentToken: true,
        back: '3'
      }
    },
    {
      path: '/myorder',
      name: '全部订单',
      component: () => import('@/pages/h5/my/orderList'),
      meta: {
        appAgentToken: true,
        back: '3' // 针对app返回上一页my
      }
    },
    {
      path: '/myorderDetail/:id?',
      name: '订单详情',
      component: () => import('@/pages/h5/my/orderList/detail')
    },
    {
      path: '/customer',
      name: '客户管理',
      component: () => import('@/pages/h5/my/customerList'),
      meta: {
        appAgentToken: true,
        back: '3' // 针对app返回上一页my
      }
    },
    {
      path: '/claims',
      name: '理赔报案订单',
      component: () => import('@/pages/h5/my/claims'),
      meta: {
        appAgentToken: true,
        back: '3' // 针对app返回上一页my
      }
    },
    // consulting 
    {
      path: '/consulting/:id?',
      name: '理赔咨询',
      component: () => import('@/pages/h5/my/claimsConsulting'),
      meta: {
        appAgentToken: false,
        back: '3' // 针对app返回上一页my
      }
    },
    //理赔提交成功
    {
      path: '/claimsSuccess',
      name: '提交理赔成功',
      component: () => import('@/pages/h5/my/claimsConsulting/claimsSuccess'),
      meta: {
        appAgentToken: false,
        back: '3' // 针对app返回上一页my
      }
    },
    {
      path: '/birthdayRemind',
      name: '生日提醒',
      component: () => import('@/pages/h5/my/customerList/birthdayRemind'),
      meta: {
        appAgentToken: true
      }
    },
    {
      path: '/birthday',
      name: '生日贺卡',
      component: () => import('@/pages/h5/my/customerList/birthday')
    },
    {
      path: '/customerIndetail/:id?',
      name: '客户详情',
      component: () => import('@/pages/h5/my/customerList/customerIndetail'),
      meta: {
        appAgentToken: true,
        back: '-1' // 针对app返回上一页
      }
    },
    {
      path: '/addCustomer/:id?',
      name: '新增客户',
      component: () => import('@/pages/h5/my/addcustomer')
    },
    // “我的”页面---帮助中心
    {
      path: '/help',
      name: '帮助中心',
      component: () => import('@/pages/h5/my/help'),
      meta: {
        appAgentToken: true,
        back: '3' // 针对app返回上一页my
      }
    },
    // “我的”页面---设置
    {
      path: '/setting',
      name: '设置',
      component: () => import('@/pages/h5/my/setting')
    },
    {
      path: '/phone',
      name: '修改手机号',
      component: () => import('@/pages/h5/my/setting/phone')
    },
    // “我的”页面---设置---输入验证码
    {
      path: '/validation',
      name: '输入验证码',
      component: () => import('@/pages/h5/my/setting/validation')
    },
    // “我的”页面---设置---密码修改
    {
      path: '/password',
      name: '修改密码',
      component: () => import('@/pages/h5/my/setting/password')
    },
    // “我的”页面---设置---注销
    {
      path: '/cancellation',
      name: '账号注销',
      component: () => import('@/pages/h5/my/setting/cancellation')
    },
    // “我的”页面---个人资料
    {
      path: '/myInfo',
      name: '个人资料 ',
      component: () => import('@/pages/h5/my/myInfo'),
      meta: {
        appAgentToken: true,
        back: '3' // 针对app返回上一页
      }
    },
    // 我的---预估收入
    {
      path: '/revenue',
      name: '预估收入 ',
      component: () => import('@/pages/h5/my/revenue'),
      meta: {
        appAgentToken: true,
        back: '3' // 针对app返回上一页
      }
    },
    // 我的---预估收入---月度报表
    {
      path: '/revenueDetail/:yearMonth',
      name: '月度报表 ',
      component: () => import('@/pages/h5/my/revenue/detail')
    },
    // 消息
    {
      path: '/msg',
      name: '消息',
      component: () => import('@/pages/h5/msg')
    },
    // 消息---系统公告页面
    {
      path: '/msgSys',
      name: '平台消息',
      component: () => import('@/pages/h5/msg/sys')
    },
    // 消息---万利头条页面
    {
      path: '/msgManley',
      name: '我的消息',
      component: () => import('@/pages/h5/msg/manley')
    },
    // 消息---详情页面
    {
      path: '/msgDetail/:id?',
      name: '消息详情',
      component: () => import('@/pages/h5/msg/detail'),
      meta: {
        appAgentToken: true,
        back: '-1' // 针对app返回上一页
      }
    },
    // 产品动态
    {
      path: '/productDynamics',
      name: '产品动态',
      component: () => import('@/pages/h5/product/dynamics')
      // meta: {
      //   appAgentToken: true,
      //   back: '-1' // 针对app返回上一页
      // }
    },
    {
      path: '/productDynamicsDetail',
      name: '产品动态详情',
      component: () => import('@/pages/h5/product/dynamics/detail'),
      meta: {
        appAgentToken: true,
        back: '-1' // 针对app返回上一页
      }
    },
    // 万利优选
    {
      path: '/productOptimization',
      name: '万利优选',
      component: () => import('@/pages/h5/product/optimization'),
      meta: {
        appAgentToken: false,
        back: '0' // 针对app返回上一页home
      }
    },
    //核保成功
    {
      path: '/submitSuccess/:contractId?',
      name: '提交核保成功',
      component: () => import('@/pages/h5/product/submit/submitSuccess')
    },
    //核保失败
    {
      path: '/submitError/:contractId?',
      name: '提交核保失败',
      component: () => import('@/pages/h5/product/submit/submitError')
    },
    //订单详情
    {
      path: '/baodan/:id?',
      name: '订单详情',
      component: () => import('@/pages/h5/product/baodan')
    },
    {
      path: '/linkurl',
      name: '图片详情',
      component: () => import('@/pages/h5/product/baodan/linkUrl')
    },
    //搜索历史
    {
      path: '/searchHistory',
      name: '搜索历史',
      component: () => import('@/pages/h5/search'),
      meta: {
        keepAlive: false,
        appAgentToken: false,
        back: '0' // 针对app返回上一页home
      }
    },
    //加入我们
    {
      path: '/joinUs',
      name: '加入我们',
      component: () => import('@/pages/h5/join/us'),
      meta: {
        appAgentToken: false,
        back: '3' // 针对app返回上一页my
      }
    },
    //答题
    {
      path: '/joinAnswer',
      name: '加入万利',
      component: () => import('@/pages/h5/join/answer')
    },
    // 登录---隐私页面
    {
      path: '/loginPrivacy',
      name: '万利保险平台用户服务协议',
      component: () => import('@/pages/h5/login/privacy'),
      meta: {
        appAgentToken: false,
        back: '-1' // 针对app返回上一页
      }
    },
    // 登录---注册协议页面
    {
      path: '/loginRegister',
      name: '隐私政策',
      component: () => import('@/pages/h5/login/privacyLink'),
      meta: {
        appAgentToken: false,
        back: '-1' // 针对app返回上一页
      }
    },

    // 我的理赔---理赔服务费协议
    {
      path: '/claimServiceFee',
      name: '理赔咨询服务及收费标准',
      component: () => import('@/pages/h5/my/claimsConsulting/claimServiceFee'),
      meta: {
        appAgentToken: false,
        back: '-1' // 针对app返回上一页
      }
    },
    // 客户告知书
    {
      path: '/customerNotification',
      name: '客户告知书',
      component: () => import('@/pages/h5/product/customerNotification'),
      meta: {
        appAgentToken: false,
        back: '-1' // 针对app返回上一页
      }
    },
    {
      path: '/loginToHome',
      name: '',
      component: () => import('@/pages/h5/common/index'),
      meta: {
        appAgentToken: true,
        back: '-1' // 针对app返回上一页
      }
    }
  ]
}

export default options
